import requests


def getPOI(api_key,location,radius,keyword,page_num):
  page_num=0

  url='http://api.map.baidu.com/place/v2/search?'
  params={
    'query':keyword,
    'location':location,
    'radius':radius,
    'output':'json',
    'page_size':20,
    'page_num':page_num,
    'ak':api_key
  }
  response=requests.get(url,params=params)
  result=response.json()
  pois=result.get('results')
  return pois


# api_key="uFhXnbEV82tFALLNVnTTJp4yZtKwddzY"
# location='39.915,116.404'
# radius=1000
# keyword='餐厅'
# pois=getPOI(api_key,location,radius,keyword)
# for poi in pois:
#   print(poi.get('name'),poi.get('address'))